package com.woniuxy.main.login_yjj.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.woniuxy.main.login_yjj.pojo.LoginUser;
import com.woniuxy.main.login_yjj.pojo.User_Yjj;
import com.woniuxy.main.login_yjj.pojo.venue;

@Mapper
public interface LoginMapper {
	
	/**
	 * 根据手机号查询 手机号、密码
	 * @param loginUser
	 * @return
	 */
	@Select("select user_phone,user_pwd from user where user_phone=#{user_phone}")
	public LoginUser finduser(LoginUser loginUser);
	
	
	/**
	 * 用户注册：插入user表：手机号，密码
	 * @param loginUser
	 */
    @Insert("insert into user(user_phone,user_pwd) values (#{user_phone},#{user_pwd})")
	public void adduser(LoginUser loginUser);
    
    
    @Select("select user_phone,user_pwd from user where user_phone=#{user_phone}")
	public LoginUser login(LoginUser loginUser);

    
    /**
     * 用户根据手机号修改密码
     * @param loginUser
     */
    @Update("update user set user_pwd=#{user_pwd} where user_phone=#{user_phone}")
	public void updatp(LoginUser loginUser);

    
    /**
     * 根据手机号查询该用户详细信息  用户（id、姓名、手机号、头像、昵称 、角色、经纬度）
     * @param phone
     * @return
     */
    @Select("select user_id,user_pwd,user_name,user_phone,user_headimg,user_nickname,role_id,longitude,latitude from user where user_phone=#{phone}")
    public User_Yjj findUserByPhone(String phone);
   
    
    
    @Select("select flag from user where user_phone=#{user_phone}")
	public LoginUser findpm(LoginUser loginUser);

    
    @Select("select user_id,user_pwd,user_name,user_phone,user_headimg,user_nickname,role_id,longitude,latitude from user where role_id=2 ")
	public List<User_Yjj> findcoch();

	@Select("select user_id,user_pwd,user_name,user_phone,user_headimg,user_nickname,role_id,longitude,latitude from user where role_id=1 ")
//	and user_name LIKE '%${user_name}%'
	public List<User_Yjj> findus();

	@Select("select venue_id,user_id,venue_name,venue_detail,img1,img3 from venue")
	public List<venue> findvenue();
    
    
}
